<!doctype html>
<html>
	<head>
		<meta charset="UTF-8" />
		<title>系统后台</title>
		<meta http-equiv="X-UA-Compatible" content="chrome=1,IE=edge" />
		<meta name="renderer" content="webkit|ie-comp|ie-stand">
		<meta name="robots" content="noindex,nofollow">
		<link href="/Public/Assets/Miniweb/css/admin_login.css" rel="stylesheet" />
		<link href="/Public/Assets/Hui/lib/validator/jquery.validator.css" rel="stylesheet" type="text/css" />
		
		<style>
			#login_btn_wraper{
				text-align: center;
			}
			#login_btn_wraper .tips_success{
				color:#fff;
			}
			#login_btn_wraper .tips_error{
				color:#DFC05D;
			}
			.msg-box {
				position: absolute;
				z-index: 1000;
			}
		</style>
		<script>
			if (window.parent !== window.self) {
					document.write = '';
					window.parent.location.href = window.self.location.href;
					setTimeout(function () {
							document.body.innerHTML = '';
					}, 0);
			}
		</script>
		
	</head>
<body>
	<div class="wrap">
		<h1><a href="__ROOT__">后台登录</a></h1>
		<form method="post" name="login" id="loginForm" action="{:U('public/login_post')}" data-validator-option="{theme:'yellow_right_effect',stopOnError:true}">
			<div class="login">
				<ul>
					<li>
						<input class="input" id="J_admin_name" name="username" data-rule="邮箱或用户名:required;"  placeholder="邮箱 | 用户名" value="{$_COOKIE['admin_username']}"/>
					</li>
					<li>
						<input class="input" id="admin_pwd" type="password" name="password" data-rule="密码: required;password;" placeholder="密码" />
					</li>
					<li>
						<div id="J_verify_code">
							<img class="yanzheng_img" id="code_img" alt="" src="{:U('/admin/verify/verify/id/adminlogin','l=4&fontsize=26&w=238&h=50')}"
							onclick="document.getElementById('code_img').src='{:U('/admin/verify/verify/id/adminlogin','l=4&fontsize=26&w=238&h=50')}&time='+Math.random();"
							style="cursor: pointer;" title="点击获取"/>
						</div>
					</li>
					<li>
						<input class="input" type="text" name="verify" placeholder="请输入验证码" data-rule="验证码:required;remote[/admin/verify/verifycheck/id/adminlogin]" maxlength="5"/>
					</li>
				</ul>
				<div id="login_btn_wraper">
					<button type="submit" name="submit" class="btn btn_submit J_ajax_submit_btn">登录</button>
				</div>
			</div>
		</form>
	</div>

<script type="text/javascript" src="/Public/Assets/Hui/lib/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="/Public/Assets/Hui/lib/validator/jquery.validator.js"></script> 
<script type="text/javascript" src="/Public/Assets/Hui/lib/validator/local/zh_CN.js"></script> 
<script type="text/javascript" src="/Public/Assets/Hui/lib/layer/1.8.0/layer.min.js"></script>
<script>
$(function($) {
	$('#loginForm').validator({
   	    //待验证字段集合
   	    valid: function(form){
   	    	var me = this;
   	    	//防止重复提交表单
   	        me.holdSubmit();
	   	    var ii = layer.load('数据处理中...');
	   	    
   	     	$.ajax({
	            url:$('#loginForm').attr('action'),
	            data: $(form).serialize(),
	            type: "POST",
	            success: function(data){
	            	layer.close(ii);
	            	if (data.status==1) {
	            		//layer.msg(data.info, 2, 1); //2秒后自动关闭，-1代表不显示图标
	                    //setTimeout(function(){
	                        location.href= data.url;
	                   // },1500);
	                }else{
	                	layer.msg(data.info, 1, 8);
	                    setTimeout(function(){
	                        if (data.url) {
	                            location.href=data.url;
	                        }else{
	                            $('#top-alert').find('button').click();
	                        }
	                        //表单可提交
	                    me.holdSubmit(false);
	                    },1500);
	                    $('#code_img').click();
	                }
	            	
	            }
	        });
   	        
   	    }
   	}).on("click", "#regsubmit", function(e){
   	    $(e.delegateTarget).trigger("validate");
   	}); 
})
</script>
</body>
</html>
